home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / filutil / bfind409.zip / BFIND.DOC next >
Text File  |  1994-09-17  |  14KB  |  297 lines

  1. BFIND.DOC
  2. 09/17/94
  3.  
  4. The BFIND.EXE program adds Boolean logic to DOS's FIND command.  Features:
  5.  
  6.   * In most ways, identical to DOS FIND command except...
  7.   * Adds AND, OR, NOT, and XOR options to searches (finding all lines with
  8.     "Apples" or "Bananas", for example)
  9.   * Allows you to specify the starting column of the desired string
  10.   * Adds a pause (/P) option to have the output pause every 24 lines
  11.   * Avoids need to include the search string in quotation marks so you can
  12.     use the program more easily in batch commands.
  13.  
  14.  
  15. The DOS FIND command allows you to find lines in a text file which contain a
  16. given string.  You can also have the program tell you how many lines met the
  17. search criteria without actually viewing them which is an ideal way to find out
  18. how many times a given string appears in your file.  You can even use FIND to
  19. tell you how many total lines are in a given file just by requesting a string
  20. that you know will never appear in your file like "#X$S$".
  21.  
  22. BFIND adds to these capabilities.  It gives you the power of AND, OR, NOT, and
  23. XOR allowing you to find any line, for example, that contains both "Apples" and
  24. "Oranges" or to present any lines that contain either "Bananas" and "Pears".  In
  25. addition, you can do column-specific searching, finding only those lines, say,
  26. that contain "PRINT" beginning in column 10.
  27.  
  28.  
  29.  
  30. The BFIND.INI file:
  31.  
  32. BFIND will read a BFIND.INI file if one is found.  (You can specify a different
  33. file name if desired.) The file is an ASCII text file that can be created
  34. maintained by hand.  The file can consist or one or more command line parameters
  35. (only those that begin with a "/"), one statement per line.
  36.  
  37. The file can also contain comments which are blank lines or any line beginning
  38. with:
  39.         ;    (semi-colon)
  40.         :    (colon)
  41.         '    (quote)
  42.  
  43. AV looks for the initialization file in your default subdirectory first.  It
  44. then searches for it in the subdirectory where the executable was and then goes
  45. through your DOS path.
  46.  
  47. Passing in "/INULL" skips loading the BFIND.INI file.
  48.  
  49.  
  50. CONFIGWS.EXE:
  51.  
  52. In addition to using the BFIND.INI file, you can permanently change some
  53. defaults within BFIND.EXE by using the older CONFIGWS.EXE program.  Currently,
  54. for BFIND only, CONFIGWS.EXE is distributed with the BFIND distribution package
  55. only.  In future releases, CONFIGWS.EXE will be dropped from the package.
  56.  
  57. CONFIGWS.EXE allows you to set the following defaults:
  58.  
  59.         Reverse match criteria:  /V or /-V
  60.         Show counts only:        /C or /-C
  61.         Number lines:            /N or /-N
  62.         Case insensitive:        /I or /-I
  63.         Pause output:            /P or /-P
  64.         Include headings:        /HEADER or /-HEADER
  65.  
  66. When setting options, the program will process defaults in the following order:
  67.   (1) CONFIGWS.EXE-settable settings
  68.   (2) BFIND.INI settings
  69.   (3) command-line settings
  70.  
  71. The *last* settings encountered win.
  72.  
  73.  
  74.  
  75. Syntax:
  76.  
  77.     BFIND [ /V | /-V ] [ /C | /-C ] [ /N | /-N ] [ /I | /-I ] [ /P | /-P ]
  78.       [ /-HEADER | /HEADER ] [ /Iinitfile | /INULL ]
  79.       { search } infile [ /? ] [ >filename ]
  80.  
  81. where:
  82.  
  83. "/V" says to find those items that do NOT match the specification.
  84.  
  85. "/-V" is the opposite of /V and is typically the default.
  86.  
  87. "/C" says to show the count of the items found (no individual lines).
  88.  
  89. "/-C" is the opposite of /C and is typically the default.
  90.  
  91. "/N" says to number the output lines.
  92.  
  93. "/-N" is the opposite of /N and is typically the default.
  94.  
  95. "/I" says to make it a case-insensitive search.
  96.  
  97. "/-I" is the opposite of /I and is typically the default.
  98.  
  99. "/P" says to have the display pause every 24 lines.
  100.  
  101. "/-P" is the opposite of /P and is typically the default.
  102.  
  103. "/-HEADER" says to skip the normal -----infile output line.
  104.  
  105. "/HEADER" is the opposite of /-HEADER and is typically the default.
  106.  
  107. "/Iinitfile" says to read an initialization file with the file name "initfile".
  108. The file specification *must* contain a period.  If no drive or path information
  109. is specified, the program will search for initfile beginning in your default
  110. subdirectory and then going throughout your DOS path.  The use of an
  111. initialization file is optional.  Initially defaults to "/IBFIND.INI".
  112.  
  113. "/INULL" says to skip loading the BFIND.INI initialization file.
  114.  
  115. "search" is described below.
  116.  
  117. "infile" is the name of the input file.
  118.  
  119. "/?" or "/HELP" or "HELP" shows you the syntax for the command.
  120.  
  121. ">filename" redirects the output to a text file.  This automatically invokes
  122. the /-P option.  This is useful for saving the found lines into another
  123. file.  For example:
  124.  
  125.         BFIND "Bruce" TEMP.TXT > TEMP2.TXT
  126.  
  127.  
  128. BFIND directly supports all FIND options except for allowing multiple file
  129. names; use the DOS FOR command if you want that.  Options supported include the
  130. /V, /C, /N, /I (which was added in MS-DOS 5.0), infile, /?, and the redirection
  131. specifications.  FIND makes the file name be position sensitive--you cannot put
  132. the infile name before the switches--and BFIND adheres to that rule.
  133.  
  134. For search, the syntax is:
  135.   [ ( ]... search_item [ boolean [ ( ]... search_item [ ) ]...] [ ) ]...
  136. where:
  137.   ( and )     are used to group items
  138.   search_item is shown below
  139.   boolean     is AND, OR, or XOR (NOT is included with search_item)
  140.  
  141. for search_item, the syntax is:
  142.   [ NOT ]  "string" [ column ]
  143. where:
  144.   NOT         is obvious
  145.   string      the string to search; the quotation marks are typically not
  146.               required unless the string contains a space or a reserved word
  147.   column      is the column in which the string must be found.
  148.  
  149. So, let's cover some examples:
  150.  
  151.         BFIND "Bugs Bunny" OR "Elmer Fudd" TEST.TXT
  152.  
  153. Finds any lines in the file TEST.TXT containing either "Bugs Bunny" or "Elmer
  154. Fudd" in them.
  155.  
  156.         BFIND (Apples or Oranges) AND NOT Pears TEST2.TXT
  157.  
  158. Finds any lines in the file TEST2.TXT which contain the words "Apples" or
  159. "Oranges" in them and ignores any lines containing "Pears".  Note that the
  160. quotes around the search words are not required unless the words include spaces
  161. or unless they could be confused with some other keywords.  "BFIND OR OR AND
  162. TEST3.TXT" might cause the program to get confused since "OR" and "AND", which
  163. you want to look for as also keywords.
  164.  
  165.         BFIND /C "Bugs Bunny" AND Martians TEST.TXT
  166.  
  167. Gives you a total for the number of lines containing both "Bugs Bunny" and
  168. "Martians".
  169.  
  170. The search string can include any text characters.  It can also contain ASCII
  171. codes, created either using the Alt key in combination with the numeric keypad
  172. (e.g.  Alt-228 to get a Sigma character) or else by embedding a hexadecimal code
  173. (in the form &Hxx) or a decimal code (in the form \nnn) in the text.  You can
  174. get a table of hexadecimal codes at the end of this documentation or by saying
  175. "BFIND /?&H".  For example, to find the smiley face character in a file called
  176. TEST.TXT, either of the following work:
  177.  
  178.         BFIND "" TEST.TXT
  179.         BFIND \001 TEST.TXT
  180.  
  181. You can press the Esc character to abort the search early.
  182.  
  183.  
  184. Remember that BFIND, unlike FIND, typically doesn't require the search string to
  185. be in quotes.  As a result, you can create a text file (presume it's called
  186. C:\BAT\PHONE.TXT) containing phone numbers or something and then create a batch
  187. file (like PHONES.BAT) that looks like this:
  188.  
  189.         BFIND %1 %2 %3 %4 %5 C:\BAT\PHONE.TXT
  190.  
  191. When you want to find a phone number, you just say "PHONE name".  This is a
  192. little more natural that using FIND which would require that you enclose the
  193. name in quotes.  You can still use the Boolean operators in BFIND; the batch
  194. file above would allow up to five parameters.  Remember, though, if you're doing
  195. multiple-word names (like "Bruce Guthrie"), you have to enclose the name in
  196. quotes or use AND.  Both of the following would work with the batch file shown
  197. above (although the second option may produce more hits):
  198.  
  199.         PHONE "Bruce Guthrie"
  200.         PHONE Bruce AND Guthrie
  201.  
  202.  
  203. Return codes:
  204.  
  205. BFIND returns the following ERRORLEVEL codes:
  206.         0 = no problems, string found
  207.         1 = no problems, string not found
  208.       255 = syntax problems, file not found, or /? requested
  209.  
  210.  
  211. Author:
  212.  
  213. This program was written by Bruce Guthrie of Wayne Software.  It is free for use
  214. and redistribution provided relevant documentation is kept with the program, no
  215. changes are made to the program or documentation, and it is not bundled with
  216. commercial programs or charged for separately.  People who need to bundle it in
  217. for-sale packages must pay a $50 registration fee to "Wayne Software" at the
  218. following address.
  219.  
  220. Additional information about this and other Wayne Software programs can be found
  221. in the file BRUCEymm.DOC which should be included in the original ZIP file.
  222. ("ymm" is replaced by the last digit of the year and the two digit month of the
  223. release.  BRUCE312.DOC came out in December 1993.  This same naming convention
  224. is used in naming the ZIP file that this program was included in.) Comments and
  225. suggestions can also be sent to:
  226.  
  227.                 Bruce Guthrie
  228.                 Wayne Software
  229.                 113 Sheffield St.
  230.                 Silver Spring, MD 20910
  231.  
  232.                 fax: (301) 588-8986
  233.  
  234. See BRUCEymm.DOC file for additional contact information.
  235.  
  236. Foreign users:  Please provide an Internet e-mail address in all correspondence.
  237.  
  238.  
  239. Decimal and hexadecimal codes:
  240.   e.g. "\066\097\116" and "&H426174" both are "Bat"
  241. +---------------------------------------------------------------------------
  242. | dec  hex chr | dec  hex chr | dec  hex chr | dec  hex chr | dec  hex chr |
  243. +--------------+--------------+--------------+--------------+--------------+
  244. | \000 &H00 nul| \052 &H34 4  | \104 &H68 h  | \156 &H9C £  | \208 &HD0 ╨  |
  245. | \001 &H01   | \053 &H35 5  | \105 &H69 i  | \157 &H9D ¥  | \209 &HD1 ╤  |
  246. | \002 &H02   | \054 &H36 6  | \106 &H6A j  | \158 &H9E ₧  | \210 &HD2 ╥  |
  247. | \003 &H03   | \055 &H37 7  | \107 &H6B k  | \159 &H9F ƒ  | \211 &HD3 ╙  |
  248. | \004 &H04   | \056 &H38 8  | \108 &H6C l  | \160 &HA0 á  | \212 &HD4 ╘  |
  249. | \005 &H05   | \057 &H39 9  | \109 &H6D m  | \161 &HA1 í  | \213 &HD5 ╒  |
  250. | \006 &H06   | \058 &H3A :  | \110 &H6E n  | \162 &HA2 ó  | \214 &HD6 ╓  |
  251. | \007 &H07 bel| \059 &H3B ;  | \111 &H6F o  | \163 &HA3 ú  | \215 &HD7 ╫  |
  252. | \008 &H08 bs | \060 &H3C <  | \112 &H70 p  | \164 &HA4 ñ  | \216 &HD8 ╪  |
  253. | \009 &H09 tab| \061 &H3D =  | \113 &H71 q  | \165 &HA5 Ñ  | \217 &HD9 ┘  |
  254. | \010 &H0A lf | \062 &H3E >  | \114 &H72 r  | \166 &HA6 ª  | \218 &HDA ┌  |
  255. | \011 &H0B vt | \063 &H3F ?  | \115 &H73 s  | \167 &HA7 º  | \219 &HDB █  |
  256. | \012 &H0C pg | \064 &H40 @  | \116 &H74 t  | \168 &HA8 ¿  | \220 &HDC ▄  |
  257. | \013 &H0D cr | \065 &H41 A  | \117 &H75 u  | \169 &HA9 ⌐  | \221 &HDD ▌  |
  258. | \014 &H0E   | \066 &H42 B  | \118 &H76 v  | \170 &HAA ¬  | \222 &HDE ▐  |
  259. | \015 &H0F   | \067 &H43 C  | \119 &H77 w  | \171 &HAB ½  | \223 &HDF ▀  |
  260. | \016 &H10   | \068 &H44 D  | \120 &H78 x  | \172 &HAC ¼  | \224 &HE0 α  |
  261. | \017 &H11   | \069 &H45 E  | \121 &H79 y  | \173 &HAD ¡  | \225 &HE1 ß  |
  262. | \018 &H12   | \070 &H46 F  | \122 &H7A z  | \174 &HAE «  | \226 &HE2 Γ  |
  263. | \019 &H13   | \071 &H47 G  | \123 &H7B {  | \175 &HAF »  | \227 &HE3 π  |
  264. | \020 &H14   | \072 &H48 H  | \124 &H7C |  | \176 &HB0 ░  | \228 &HE4 Σ  |
  265. | \021 &H15   | \073 &H49 I  | \125 &H7D }  | \177 &HB1 ▒  | \229 &HE5 σ  |
  266. | \022 &H16   | \074 &H4A J  | \126 &H7E ~  | \178 &HB2 ▓  | \230 &HE6 µ  |
  267. | \023 &H17   | \075 &H4B K  | \127 &H7F   | \179 &HB3 │  | \231 &HE7 τ  |
  268. | \024 &H18   | \076 &H4C L  | \128 &H80 Ç  | \180 &HB4 ┤  | \232 &HE8 Φ  |
  269. | \025 &H19   | \077 &H4D M  | \129 &H81 ü  | \181 &HB5 ╡  | \233 &HE9 Θ  |
  270. | \026 &H1A eof| \078 &H4E N  | \130 &H82 é  | \182 &HB6 ╢  | \234 &HEA Ω  |
  271. | \027 &H1B esc| \079 &H4F O  | \131 &H83 â  | \183 &HB7 ╖  | \235 &HEB δ  |
  272. | \028 &H1C   | \080 &H50 P  | \132 &H84 ä  | \184 &HB8 ╕  | \236 &HEC ∞  |
  273. | \029 &H1D ???| \081 &H51 Q  | \133 &H85 à  | \185 &HB9 ╣  | \237 &HED φ  |
  274. | \030 &H1E ???| \082 &H52 R  | \134 &H86 å  | \186 &HBA ║  | \238 &HEE ε  |
  275. | \031 &H1F ???| \083 &H53 S  | \135 &H87 ç  | \187 &HBB ╗  | \239 &HEF ∩  |
  276. | \032 &H20    | \084 &H54 T  | \136 &H88 ê  | \188 &HBC ╝  | \240 &HF0 ≡  |
  277. | \033 &H21 !  | \085 &H55 U  | \137 &H89 ë  | \189 &HBD ╜  | \241 &HF1 ±  |
  278. | \034 &H22 "  | \086 &H56 V  | \138 &H8A è  | \190 &HBE ╛  | \242 &HF2 ≥  |
  279. | \035 &H23 #  | \087 &H57 W  | \139 &H8B ï  | \191 &HBF ┐  | \243 &HF3 ≤  |
  280. | \036 &H24 $  | \088 &H58 X  | \140 &H8C î  | \192 &HC0 └  | \244 &HF4 ⌠  |
  281. | \037 &H25 %  | \089 &H59 Y  | \141 &H8D ì  | \193 &HC1 ┴  | \245 &HF5 ⌡  |
  282. | \038 &H26 &  | \090 &H5A Z  | \142 &H8E Ä  | \194 &HC2 ┬  | \246 &HF6 ÷  |
  283. | \039 &H27 '  | \091 &H5B [  | \143 &H8F Å  | \195 &HC3 ├  | \247 &HF7 ≈  |
  284. | \040 &H28 (  | \092 &H5C \  | \144 &H90 É  | \196 &HC4 ─  | \248 &HF8 °  |
  285. | \041 &H29 )  | \093 &H5D ]  | \145 &H91 æ  | \197 &HC5 ┼  | \249 &HF9 ∙  |
  286. | \042 &H2A *  | \094 &H5E ^  | \146 &H92 Æ  | \198 &HC6 ╞  | \250 &HFA ·  |
  287. | \043 &H2B +  | \095 &H5F _  | \147 &H93 ô  | \199 &HC7 ╟  | \251 &HFB √  |
  288. | \044 &H2C ,  | \096 &H60 `  | \148 &H94 ö  | \200 &HC8 ╚  | \252 &HFC ⁿ  |
  289. | \045 &H2D -  | \097 &H61 a  | \149 &H95 ò  | \201 &HC9 ╔  | \253 &HFD ²  |
  290. | \046 &H2E .  | \098 &H62 b  | \150 &H96 û  | \202 &HCA ╩  | \254 &HFE ■  |
  291. | \047 &H2F /  | \099 &H63 c  | \151 &H97 ù  | \203 &HCB ╦  | \255 &HFF    |
  292. | \048 &H30 0  | \100 &H64 d  | \152 &H98 ÿ  | \204 &HCC ╠  |              |
  293. | \049 &H31 1  | \101 &H65 e  | \153 &H99 Ö  | \205 &HCD ═  |              |
  294. | \050 &H32 2  | \102 &H66 f  | \154 &H9A Ü  | \206 &HCE ╬  |              |
  295. | \051 &H33 3  | \103 &H67 g  | \155 &H9B ¢  | \207 &HCF ╧  |              |
  296. +--------------+--------------+--------------+--------------+--------------+
  297.